Conversation Memory
BindAI provides a flexible memory system that applications can use to preserve useful information across agent executions. Memory is exposed through theMemory abstraction and can be attached to an agent through its memory configuration.
The current memory system is record-based. It is not limited to a specific conversation-history format, which allows applications to decide what information should be stored and how it should be retrieved.
What is Conversation Memory?
Conversation-related information can be stored asMemoryRecord objects and retrieved during later executions.
A memory record contains a key, value, namespace, and additional memory information.
Memory instance:
Attaching Memory to an Agent
An agent can be configured with aMemory instance using Agent.builder().
Storing Conversation Information
Applications can explicitly store useful conversation-related information. For example:Reading Memory
Stored information can be retrieved usingget().
MemoryResult interface.
Searching Memory
Memory also provides a query-basedsearch() operation.
- A query
- A namespace
- A result limit
- Optional metadata filtering
Namespaces
Namespaces provide logical isolation between groups of memory records. For example:- Users
- Conversations
- Tenants
- Agents
- Projects
- Applications
- Other logical memory scopes
Conversation Memory Pattern
A typical application-level conversation-memory pattern looks like this:Conversation History vs Memory Records
Memory records should not automatically be treated as a complete conversation transcript. A memory record represents structured information such as:Memory Records and Metadata
Conversation-related records can contain metadata that helps applications organize and retrieve information.- Importance
- Access count
- Expiration
- Tags
- Source
- Relationships
- Timestamps
- Embeddings
- Search score
Deleting Memory
A specific memory record can be deleted.Clearing Memory
Memory can also be cleared for a namespace.- A conversation is reset
- A user requests memory deletion
- A tenant is removed
- An application context is discarded
- Temporary memory should be cleaned up
Checking for Memory
Applications can check whether a record exists.Conversation Memory and Providers
Conversation-related memory uses the same provider architecture as the rest of BindAI’s memory system.InMemoryProviderSQLiteMemoryProviderPostgreSQLMemoryProviderVectorMemoryProviderPineconeMemoryProviderChromaMemoryProvider
InMemoryProvider or SQLiteMemoryProvider, while a server application may use PostgreSQL or a managed vector provider.
Conversation Memory with Different Providers
The memory API remains consistent when changing providers. For example, an application can use in-memory storage:Conversation Memory in Workflows
Memory can also be used by application workflows. A workflow can store information under a namespace and later retrieve it.Managing Long Conversations
Long conversations can produce large amounts of information. BindAI’s memory API provides primitives that applications can use to manage retained information, including:- Namespaces
- Search
- Deletion
- Clearing
- Metadata
- Tags
- Expiration
- Importance
- Relationships
- Memory lifecycle management
- What information should be retained
- What information should be discarded
- How long information should remain available
- Which information should be considered important
- Which namespace a memory belongs to
Memory Lifecycle
Memory records contain lifecycle-related information that applications can use to manage retention.MemoryManager provides operations for working with memory lifecycle and importance, including:
- Reinforcing records
- Weakening records
- Increasing or decreasing importance
- Setting expiration
- Clearing expiration
- Touching records
- Promoting records
- Forgetting records
- Checking promotion conditions
- Checking forgetting conditions
Conversation Memory and Agent Context
Conversation memory and the agent’s immediate execution context serve different purposes. A simplified distinction is:Conversation Memory and Knowledge
Conversation memory is also different from knowledge or RAG.- A user’s preferred programming language may belong in memory.
- A company’s product manual may belong in a knowledge base.
- A document retrieved to answer a question belongs to the knowledge/RAG workflow.
User and Conversation Isolation
Applications serving multiple users should use clear namespace strategies. For example:Resource Management
Some memory providers own external resources such as database connections or other backend resources. Applications should close memory resources when they are no longer needed:Privacy and Retention
Conversation memory can contain information derived from user interactions. Applications should therefore define appropriate retention and deletion policies. Useful practices include:- Store only information that provides application value.
- Avoid storing unnecessary sensitive information.
- Use namespaces to separate logical users or tenants.
- Provide deletion mechanisms where appropriate.
- Use expiration for temporary information.
- Protect memory access with application-level authorization.
- Keep provider credentials outside source code.
- Treat memory storage as persistent application data when using persistent providers.
Best Practices
- Use namespaces to isolate users, conversations, tenants, or other application contexts.
- Store useful structured information rather than unnecessary conversational detail.
- Use metadata and tags when records need additional organization.
- Use
search()when retrieval should be query-based. - Use
get()when a specific key is known. - Use expiration for temporary information.
- Use importance and lifecycle operations when retention policies require them.
- Delete or clear information when it is no longer required.
- Use persistent providers when memory must survive application restarts.
- Use vector-oriented providers when semantic memory retrieval is appropriate.
- Do not assume that a
MemoryRecordis automatically a complete conversation transcript. - Do not use namespaces as the only authorization mechanism.
- Protect stored memory as application data.
- Close providers when they own external resources.
Summary
BindAI provides a flexible memory system that can be used to implement conversation-aware applications. The core primitives are:Agent.builder():
